package com.sunchangpeng.client.nio;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Scanner;

public class TimeClientCli {
    private static final Logger LOGGER = LoggerFactory.getLogger(TimeClient.class);

    public static void main(String[] args) {
        TimeClient timeClient = new TimeClient("127.0.0.1", 8080);

        while (!Thread.interrupted()) {
            Scanner console = new Scanner(System.in);
            String input = console.nextLine();

            String inputUpperCase = input.toUpperCase();

            if ("EXIT".equals(inputUpperCase)) {
                LOGGER.info("Bye bye...");
                Thread.currentThread().interrupt();
            }

            timeClient.send(input);
        }
    }
}
